package com.hyacinth.cloudnote.modules.note.repository;

import com.hyacinth.cloudnote.modules.note.model.Tag;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.Repository;

import java.util.Optional;
import java.util.UUID;

/**
 * Tag实体类对应的基础业务Repository
 */
@org.springframework.stereotype.Repository
public interface TagRepository extends Repository<Tag, UUID> {

    Tag save(Tag model);

    Optional<Tag> findById(UUID id);

    Page<Tag> findAll(Pageable pageable);

    void delete(Tag tag);

    boolean existsByName(String name);

    boolean existsByNameAndIdNot(String name, UUID id);
}
